<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    
	
	<title>_入库单详情</title>
	
	  <script type="text/javascript">
      
        //美化车载信息
		function formatInfo(carInfo) {
			var carInfoArray = carInfo.split(";");
			var temp = '';
			for ( var i = 0; i < carInfoArray.length; i++) {
				var car = carInfoArray[i];
				if (car == null || car == '') {
				} else {
					temp += "【" + car + "(件)】<br/>";
				}
			}
			return temp;
		}
		
		function showBillDetail(){
	      var flag=$("#showOrhide").html();
	      
	      if(flag=="【隐藏明细】"){
	        $("#billDetail").css("display","none");
	        $("#showOrhide").html("【查看明细】");
	      }
	      else if(flag=="【查看明细】"){
	        $("#billDetail").css("display","");
	        $("#showOrhide").html("【隐藏明细】");
	      }
	    }

	</script>
	
</head>



<body>
	<div style="height: 10px;"></div>
	
	<!-- 日志 -->	
	<table id="contentTable" class="table  table-bordered table-condensed">
	    <thead>
			<th style="vertical-align: middle; color: white;" colspan="4" bgcolor="#8EB4CB">入库日志</th>
		</thead>
		<thead><tr>
		    <th style="width: 100px;">处理人</th>
		    <th style="width: 150px;">处理时间</th>
			<th style="width: 100px;">处理环节</th>
			<th >描述</th>
		</tr></thead>
		<c:forEach  items="${logList}" var="log">
			 <tr>
		       <td>${log.user.realname}</td>
		       <td>${fn:substring(log.startTime,0,19)}</td>
		       <td>
		          <c:if test="${log.workType eq '1' }">登记入库单</c:if>
			      <c:if test="${log.workType eq '2' }">点数/质检</c:if>
			      <c:if test="${log.workType eq '3' }">审核通过</c:if>
			      <c:if test="${log.workType eq '4' }">审核驳回</c:if>
			      <c:if test="${log.workType eq '5' }">创建上架任务</c:if>
			      <c:if test="${log.workType eq '6' }">上架作业完成</c:if>
		       </td>
		       <td>${log.info}</td>
			 </tr>
		</c:forEach>
	</table>
	
	  <!-- 入库登记数据 -->
	  <table  class="table  table-bordered table-condensed">
       	  <thead>
		    <th style="vertical-align: middle; color: white;" colspan="6" bgcolor="#8EB4CB">入库登记数据</th>
		  </thead>
          <tr>
             <th style="width: 80px;">入库类型</th>
             <th style="width: 120px;">入库编号</th>
             <th style="width: 120px;">相关单号</th>
             <th style="width: 100px;">箱子数量</th>
             <th style="width: 100px;">SKU数量</th>
             <th style="width: 100px;">商品数量</th>
          </tr>
          <tr>
             <td>
               <c:if test="${bill.billType eq '1' }"><font color=red>总仓入库</font></c:if>
			   <c:if test="${bill.billType eq '2' }"><font color=blue>调拨入库</font><a href="" onclick="showBillDetail(); return false" id="showOrhide">【查看明细】</a></c:if>
             </td>
             <td>${bill.instorageCode}</td>
             <td>${bill.aboutCode}</td>
             <td>${bill.boxNum}</td>
             <td>${bill.skuNum}</td>
             <td>${bill.goodsNum}</td>
          </tr>
	  </table> 
	  
	   <!-- 入库单明细 -->
	  <table class="table table-striped table-bordered table-condensed" style="display: none;" id="billDetail">
       	  <thead>
		    <th style="vertical-align: middle; color: white;" colspan="5" bgcolor="#8EB4CB">入库登记数据</th>
		  </thead>
          <tr>
             <th style="width: 120px;">商家编码</th>
             <th style="width: 120px;">sku</th>
             <th style="width: 100px;">数量</th>
          </tr>
          <c:forEach  items="${billItemList}" var="billItem">
             <tr>
               <td>${billItem.customerCode}</td>
               <td>${billItem.sku}</td>
               <td>${billItem.num}</td>
             </tr>
          </c:forEach>
	  </table>   
	
	<!-- 点收数据 -->
	<table class="table table-striped table-bordered table-condensed" id="count_table">
		<thead>
			<th style="vertical-align: middle; color: white; " colspan="5"
				bgcolor="#8EB4CB"><span>点收数据</span></th>
		</thead>
		<tr>
			<th style="width: 200px;">SKU编码</th>
			<th style="width: 130px;">散货件数量（件）</th>
			<th style="width: 130px;">破损件数量（件）</th>
			<th>整箱件数量（件/箱）</th>
			<th style="width: 130px;">总数量（件）</th>
		</tr>
		<tbody>
			<c:forEach items="${countList}" var="count">
				<tr>
					<td>${count.sku}</td>
					<td>${count.bulkNum}</td>
					<td>${count.errorNum}</td>
					<td><c:if test="${count.wholeStr ne '' }">${count.wholeStr}=${count.wholeNum}
					</td>
					</c:if>
					<c:if test="${count.wholeStr eq '' }">${count.wholeNum}</td>
					</c:if>
					<td>${count.totalNum}</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	
	<!-- 任务信息 -->
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
	    <thead>
			<th style="vertical-align: middle; color: white;" colspan="9" bgcolor="#8EB4CB">任务信息</th>
		</thead>
		<thead><tr>
		    <th style="width: 100px;">任务批次号</th>
		    <th style="width: 50px;">上架类型</th>
			<th style="width: 50px;">车编号</th>
			<th style="width: 100px;">车载信息</th>
			<th style="width: 100px;">任务完成信息</th>
			<th style="width: 80px;">指派人</th>
			<th style="width: 80px;">执行人</th>
			<th style="width: 80px;">任务状态</th>
		</tr></thead>
		<tbody>
		<c:forEach items="${taskList}" var="task">
			<tr>
			    <td>${task.taskBatch}</td>
			    <td>
			       <c:if test="${task.carType eq '1' }"><font color='blue'>整箱件</font></c:if>
			       <c:if test="${task.carType eq '2' }">散货件</c:if>
			       <c:if test="${task.carType eq '3' }"><font color='red'>破损件</font></c:if>
			    </td>
			    <td>${task.carNo}号车</td>
			    <td>
			       <script type="text/javascript">document.write(formatInfo('${task.carInfo}'));</script>
			    </td>
			    <td>
			       <script type="text/javascript">document.write(formatInfo('${task.taskInfo}'));</script>
			    </td>
			    <td>${task.commander.realname}</td>
			    <td>${task.worker.realname}</td>
			    <td>
			      <c:if test="${task.status eq '0'}">未分配</c:if>
			      <c:if test="${task.status eq '1'}">待执行</c:if>
			      <c:if test="${task.status eq '2'}">开始执行任务</c:if>
			      <c:if test="${task.status eq '3'}">任务完成</c:if>
			      <c:if test="${task.status eq '4'}">任务异常完成</c:if>
			    </td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	
	
	
	<!-- 入库商品统计-->
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
	    <thead>
			<th style="vertical-align: middle; color: white;" colspan="9" bgcolor="#8EB4CB">入库商品统计</th>
		</thead>
		<thead><tr>
		    <th style="width: 100px;">仓库</th> 
		    <th style="width: 100px;">sku</th>
		    <th >数量</th>
		</tr></thead>
		<tbody>
		<c:forEach items="${infoList}" var="info">
			<tr>
			    <td>${info.warehouseCode}</td>
			    <td>${info.sku}</td>
			    <td>${info.num}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>

	
	
</body>
</html>
